﻿using System;
using System.Collections.Generic;
using System.Data.Objects;
using System.Linq;
using System.Web;

namespace Bazza.Models
{
    public class DBManager
    {

        private String FilterText;

        public void addProject(String name, String owner)
        {
            using (ProjectsDBEntities db = new ProjectsDBEntities())
            {
                var project = new Projects {Name = name, Owner = owner};
                db.AddToProjects(project);
                //db.SaveChanges();
            }
        }

        public List<Projects> ReadProject()
        {
            ProjectsDBEntities db = new ProjectsDBEntities();
            var project = db.Projects.Where(x => x.Name == "ff" && x.Owner == "dd");
            return project.ToList();
        }

        public List<Fields> ReadFields(String filterText)
        {
            this.FilterText = filterText;
            Func<Fields, bool> predicate = FieldsPredicate;
            using (var db = new ProjectsDBEntities())
            {
                var predicats = ;
                foreach ()
                {
                    var fields = db.Fields.Where(predicate);
                    return fields.ToList();
                }
            }
        }
        private bool FieldsPredicate(Fields g)
        {
            var filter = new FilterParser("fff", );

            return true;
        }
    }
}